package ar.edu.itba.it.cg.grupo01.impl.shape.shader;

import java.awt.Color;

import javax.vecmath.Point3f;

import ar.edu.itba.it.cg.grupo01.api.Ray;
import ar.edu.itba.it.cg.grupo01.api.shape.Shape;
import ar.edu.itba.it.cg.grupo01.api.shape.light.Light;
import ar.edu.itba.it.cg.grupo01.impl.RayTraceInformation;
import ar.edu.itba.it.cg.grupo01.impl.color.Colors;

public abstract class Shader {

	public Color shadeLight(Light light, Shape shape,
			Point3f intersectionPoint, Ray ray, float contribution, float attenuation) {
		return Colors.scale(Colors.mulTo(getShadeColor(shape,intersectionPoint),Colors.scale(light.getColor(),attenuation)),contribution);
	}
	
	public Color shadeReflection(Color reflectionColor) {
		return Colors.scale(reflectionColor, getReflectionK());
	}

	public Color shadeRefraction(Color refractionColor) {
		return Colors.scale(refractionColor, getRefractionK());
	}
	
	public abstract Color getShadeColor(Shape shape, Point3f intersectionPoint);

	public float getReflectionK() {
		return 0.0f;
	}
	public float getRefractionK() {
		return 0.0f;
	}
	
	public float getRefractionIndex(){
		return 0.0f;
	}

	public abstract void shade(RayTraceInformation info);

}
